<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
     <!-- <el-form-item label="订单号" prop="orderNo">
        <el-input
          v-model="queryParams.orderNo"
          placeholder="请输入订单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
     <!-- <el-form-item label="合同号" prop="contractNo">
        <el-input
          v-model="queryParams.contractNo"
          placeholder="请输入合同号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
      <el-form-item label="订单号" prop="orderNo">
        <el-input
          v-model="queryParams.orderNo"
          placeholder="请输入订单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="排产编号" prop="pcCode">
        <el-input
          v-model="queryParams.pcCode"
          placeholder="请输入排产编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="排产日期" prop="pcDate">
        <el-date-picker clearable
          v-model="queryParams.pcDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择排产日期">
        </el-date-picker>
      </el-form-item>
    <!--  <el-form-item label="生产日期" prop="scDate">
        <el-date-picker clearable
          v-model="queryParams.scDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择生产日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="交货日期" prop="jhDate">
        <el-date-picker clearable
          v-model="queryParams.jhDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择交货日期">
        </el-date-picker>
      </el-form-item>-->
      <el-form-item label="生产线代码" prop="lineCode">
        <el-input
          v-model="queryParams.lineCode"
          placeholder="请输入生产线代码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="生产线名称" prop="lineName">
        <el-input
          v-model="queryParams.lineName"
          placeholder="请输入生产线名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="工位代码" prop="gwCode">
        <el-input
          v-model="queryParams.gwCode"
          placeholder="请输入工位代码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="工位名称" prop="gwName">
        <el-input
          v-model="queryParams.gwName"
          placeholder="请输入工位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
     <!-- <el-form-item label="设备编号" prop="deviceNo">
        <el-input
          v-model="queryParams.deviceNo"
          placeholder="请输入设备编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
    <!--  <el-form-item label="设备名称" prop="deviceName">
        <el-input
          v-model="queryParams.deviceName"
          placeholder="请输入设备名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
     <!-- <el-form-item label="员工工号" prop="empNum">
        <el-input
          v-model="queryParams.empNum"
          placeholder="请输入员工工号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
     <!-- <el-form-item label="员工姓名" prop="empName">
        <el-input
          v-model="queryParams.empName"
          placeholder="请输入员工姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
    <!--  <el-form-item label="工序产品编号" prop="gxProCode">
        <el-input
          v-model="queryParams.gxProCode"
          placeholder="请输入工序产品编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="产品名称" prop="proName">
        <el-input
          v-model="queryParams.proName"
          placeholder="请输入产品名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->

      <el-form-item label="对应产品编号" prop="dyProCode">
        <el-input
          v-model="queryParams.dyProCode"
          placeholder="请输入对应产品编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="对应原材料编号" prop="dyYclCode">
        <el-input
          v-model="queryParams.dyYclCode"
          placeholder="请输入对应原材料编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料识别码" prop="itemIdentifyCode">
        <el-input
          v-model="queryParams.itemIdentifyCode"
          placeholder="请输入物料识别码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="派工状态" prop="isPg">
        <el-select v-model="queryParams.isPg" placeholder="请选择派工状态">
          <el-option
            v-for="item in isPgOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
    <!--  <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleRead"
        >读取</el-button>
      </el-col>-->
     <!-- <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['procontrol:control:edit']"
        >修改</el-button>
      </el-col>-->
   <!--   <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['procontrol:control:remove']"
        >删除</el-button>
      </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['procontrol:control:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="controlList" :row-class-name="tableRowClassName" @selection-change="handleSelectionChange">
<!--
      <el-table-column type="selection" width="55" align="center" />
-->
      <el-table-column label="公司代码" align="center" prop="factoryCode" />
      <el-table-column label="公司名称" align="center" prop="factoryName" />
      <el-table-column label="订单号" width="150" align="center" prop="orderNo" />
      <el-table-column label="排产编号" width="150" align="center" prop="pcCode" />
      <el-table-column label="排产日期" align="center" prop="pcDate" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.pcDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产线代码" width="130" align="center" prop="lineCode" />
      <el-table-column label="生产线名称" width="130" show-overflow-tooltip align="center" prop="lineName" />
      <el-table-column label="工位代码" width="130" align="center" prop="gwCode" />
      <el-table-column label="工位名称" show-overflow-tooltip width="130" align="center" prop="gwName" />
<!--      <el-table-column label="设备编号" width="130" align="center" prop="deviceNo" />-->
<!--      <el-table-column label="设备名称" width="130" show-overflow-tooltip align="center" prop="deviceName" />-->
      <el-table-column label="派工工位编码" width="130" align="center" prop="pgGwCode" />
      <el-table-column label="派工工位名称" width="150" show-overflow-tooltip align="center" prop="pgGwName" />
      <el-table-column label="派工工位负责人" width="150" show-overflow-tooltip align="center" prop="pgGwFzr2" />
      <el-table-column label="工位人员数量" width="100" align="center" prop="gwPersonNum" />
      <el-table-column label="派工工位操作人员" width="150" show-overflow-tooltip align="center" prop="gwPersonInfo2" />
      <el-table-column label="员工工号"  align="center" prop="empNum" />
      <el-table-column label="员工姓名"width="100" align="center" prop="empName" />
      <el-table-column label="产品类型" align="center" prop="proType" />
<!--
      <el-table-column label="工序产品编号" width="130" align="center" prop="gxProCode" />
-->
      <el-table-column label="产品名称" show-overflow-tooltip width="140"  align="center" prop="proName" />
    <!--  <el-table-column label="领料物料" width="200" show-overflow-tooltip   align="center" prop="dyYclCode" />
      <el-table-column label="报工物料"  width="200" show-overflow-tooltip align="center" prop="dyProCode" />-->
      <el-table-column label="物料识别码" width="280" show-overflow-tooltip   align="center" prop="itemIdentifyCode" />
      <el-table-column label="外径公差" width="120" align="center" prop="wjgc" />
      <el-table-column label="内径公差" width="120" align="center" prop="njgc" />
      <el-table-column label="厚度公差" width="120" align="center" prop="hdgc" />
      <el-table-column label="台径*台高" width="120" align="center" prop="tjtg" />
      <el-table-column label="中心距" width="120" align="center" prop="zxj" />
      <el-table-column label="孔径+孔数" width="120" align="center" prop="kjks" />
      <el-table-column label="计算重量" width="120" align="center" prop="jszl" />
      <el-table-column label="下料重量" width="120" align="center" prop="xlzl" />
      <el-table-column label="倒角" align="center" prop="dj" width="120"/>
      <el-table-column label="水线" align="center" prop="sx" width="120"/>
      <el-table-column label="密封面倒角" align="center" prop="mfmdj" width="120"/>
      <el-table-column label="说明" align="center" prop="content"  width="180" show-overflow-tooltip/>
     <!-- <el-table-column label="对应产品编号" align="center" prop="dyProCode" />
      <el-table-column label="对应原材料编号" align="center" prop="dyYclCode" />
      <el-table-column label="对应整车图号" align="center" prop="dyZcNum" />
      <el-table-column label="订单数量" align="center" prop="orderNum" />
      <el-table-column label="未排产订单数量" align="center" prop="noPcNum" />-->
      <el-table-column label="排产数量" align="center" prop="pcNum" />
      <el-table-column label="实际完成数量" width="100" align="center" prop="finishComNum" />
      <el-table-column label="派工数量" align="center" prop="pgNum" />
      <el-table-column label="完工数量" align="center" prop="wgNum" />
      <el-table-column label="报工数量" align="center" prop="bgNum" />
      <el-table-column label="在制品数量" width="100" align="center" prop="zzNum" />
      <el-table-column label="检验数量" align="center" prop="checkNum" />
      <el-table-column label="不合格数量" width="100" align="center" prop="unqualifiedNum" />
      <el-table-column label="返修数量" align="center" prop="returnNum" />
      <el-table-column label="料废数量" align="center" prop="flNum" />
      <el-table-column label="机废数量" align="center" prop="jfNum" />
      <el-table-column label="计划上线时间" align="center" prop="planOnlineTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.planOnlineTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="实际上线时间" align="center" prop="actualOnlineTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.actualOnlineTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="计划下线时间" align="center" prop="planOfflineTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.planOfflineTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="实际下线时间" align="center" prop="actualOfflineTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.actualOfflineTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="返修上线时间" align="center" prop="returnOnlineTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.returnOnlineTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="返修下线时间" align="center" prop="returnOfflineTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.returnOfflineTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="报工时间" align="center" prop="bgTimr" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.bgTimr, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="检验时间" align="center" prop="checkTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.checkTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="质检员工号" width="100" align="center" prop="checkUserNum" />
      <el-table-column label="质检员姓名" width="100" align="center" prop="checkUserName" />
      <el-table-column label="包装时间" align="center" prop="packgeTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.packgeTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
     <!-- <el-table-column label="核销时间" align="center" prop="hxTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.hxTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>-->
      <!--<el-table-column label="材料" align="center" prop="cl" />
      <el-table-column label="下料" align="center" prop="xl" />
      <el-table-column label="加热" align="center" prop="jr" />
      <el-table-column label="成型" align="center" prop="cx" />
      <el-table-column label="冷却" align="center" prop="lq" />
      <el-table-column label="粗车" align="center" prop="cc" />
      <el-table-column label="精车" align="center" prop="jc" />
      <el-table-column label="钻孔" align="center" prop="zk" />
      <el-table-column label="检验" align="center" prop="jy" />
      <el-table-column label="包装" align="center" prop="bz" />-->
      <el-table-column label="合同号" width="130" align="center" prop="contractNo" />
      <el-table-column label="生产日期" align="center" prop="scDate" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="交货日期" align="center" prop="jhDate" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.jhDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建时间" width="160" align="center" prop="createTime" />
      <el-table-column label="创建者" align="center" prop="createBy" />
      <el-table-column label="更新时间" width="160" align="center" prop="updateTime" />
      <el-table-column label="更新者" align="center" prop="updateBy" />
      <el-table-column label="备注" width="150" show-overflow-tooltip align="center" prop="remark" />      <el-table-column fixed="right" label="操作" width="150" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-s-custom"
            @click="handlePg(scope.row)"
            v-if="scope.row.pcNum != scope.row.pgNum"
            v-hasPermi="['procontrol:orderInfo:pg']"
          >派工</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-printer"
            @click="printt(scope.row)"
            v-hasPermi="['procontrol:orderInfo:pg']"
          >打印</el-button>
        <!--  <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-if="scope.row.isSh != '1'"
            v-hasPermi="['procontrol:control:remove']"
          >删除</el-button>-->
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改生产过程控制总对话框 -->
    <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="900px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="125px">
<!--        <el-form-item label="订单号" prop="orderNo">-->
<!--          <el-input v-model="form.orderNo" placeholder="请输入订单号" readonly/>-->
<!--        </el-form-item>-->
      <!--  <el-form-item label="选择" prop="choose">
          <el-input v-model="form.choose" placeholder="请输入选择" />
        </el-form-item>-->
<!--        <el-form-item label="合同号" prop="contractNo">-->
<!--          <el-input v-model="form.contractNo" placeholder="请输入合同号" readonly/>-->
<!--        </el-form-item>-->
        <el-row>
          <el-col :span="12">
          <el-form-item label="排产编号" prop="pcCode">
          <el-input readonly v-model="form.pcCode" placeholder="请输入排产编号" readonly/>
        </el-form-item>
          </el-col>
          <el-col :span="12">
          <el-form-item label="排产日期" prop="pcDate">
            <el-date-picker readonly clearable
              v-model="form.pcDate"
              type="date"
              value-format="yyyy-MM-dd"
              placeholder="请选择排产日期">
            </el-date-picker>
          </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
          <el-form-item label="物料名称" prop="proName">
          <el-input readonly v-model="form.proName" placeholder="产品名称" readonly/>
        </el-form-item>
          </el-col>
          <el-col :span="12">
          <el-form-item label="物料识别码" prop="itemIdentifyCode">
          <el-input readonly v-model="form.itemIdentifyCode" placeholder="物料识别码" readonly/>
        </el-form-item>
          </el-col>
        </el-row>
<!--        <el-form-item label="排产日期" prop="pcDate">-->
<!--          <el-date-picker clearable-->
<!--            v-model="form.pcDate"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="请选择排产日期">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="生产日期" prop="scDate">-->
<!--          <el-date-picker clearable-->
<!--            v-model="form.scDate"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="请选择生产日期">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="交货日期" prop="jhDate">-->
<!--          <el-date-picker clearable-->
<!--            v-model="form.jhDate"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="请选择交货日期">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
        <el-row>
          <el-col :span="12">
          <el-form-item label="产线代码" prop="lineCode">
          <el-input readonly v-model="form.lineCode" placeholder="生产线代码" />
        </el-form-item>
          </el-col>
          <el-col :span="12">
          <el-form-item label="产线名称" prop="lineName">
          <el-input readonly v-model="form.lineName" placeholder="生产线名称" />
        </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="派工工位编码" prop="pgGwCode">
              <el-input readonly v-model="form.pgGwCode" placeholder="派工工位编码" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="派工工位名称" prop="pgGwName">
              <el-input readonly v-model="form.pgGwName" placeholder="派工工位名称" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="排产数量" prop="pcNum">
              <el-input readonly v-model="form.pcNum" placeholder="排产数量" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="已派工数量" prop="pgNum">
              <el-input readonly v-model="form.pgNum" placeholder="已派工数量" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-table  v-loading="loading"  :summary-method="getSummaries" show-summary :data="userOrderinfoList" @selection-change="handleSelectionChange" row-key="columnId" :max-height="tableHeight">
          <el-table-column label="员工工号" align="center" prop="empNum" />
          <el-table-column label="员工姓名" align="center" prop="empName" />
          <el-table-column label="派工数量" align="center" prop="pgNum" >
            <template slot-scope="scope">
              <div style="display:flex">
                <el-input  clearable style="display:inline"v-model="scope.row.pgNum"></el-input>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.$index,scope.row)"
              >删除</el-button>
            </template>
          </el-table-column>
        </el-table>

        <!--<el-form-item label="工位代码" prop="gwCode">
          <el-select @change="getGwCode" v-model="form.gwCode" placeholder="请选择工位代码">
            <el-option
              v-for="item in gwCodeList"
              :key="item.stationCode"
              :label="item.stationName"
              :value="item.stationCode">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="派工工位编码" prop="pgGwCode">
          <el-input v-model="form.pgGwCode" placeholder="请输入派工工位编码" />
        </el-form-item>
        <el-form-item label="派工工位名称" prop="pgGwName">
          <el-input v-model="form.pgGwName" placeholder="请输入派工工位名称" />
        </el-form-item>
        <el-form-item label="派工工位负责人" prop="pgGwFzr2">
          <el-input v-model="form.pgGwFzr2" placeholder="请输入派工工位负责人" />
        </el-form-item>
        <el-form-item label="工位人员数量" prop="gwPersonNum">
          <el-input v-model="form.gwPersonNum" placeholder="请输入工位人员数量" />
        </el-form-item>
        <el-form-item label="派工工位操作人员" prop="gwPersonInfo2">
          <el-input v-model="form.gwPersonInfo2" placeholder="请输入派工工位操作人员" />
        </el-form-item>-->
      <!--  <el-form-item label="员工工号" prop="empNum">
          <el-input v-model="form.empNum" placeholder="请输入员工工号" />
        </el-form-item>
        <el-form-item label="员工姓名" prop="empName">
          <el-input v-model="form.empName" placeholder="请输入员工姓名" />
        </el-form-item>-->

<!--        <el-form-item label="对应原材料编号" prop="dyYclCode">-->
<!--          <el-input v-model="form.dyYclCode" placeholder="请输入对应原材料编号" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="对应整车图号" prop="dyZcNum">-->
<!--          <el-input v-model="form.dyZcNum" placeholder="请输入对应整车图号" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="订单数量" prop="orderNum">-->
<!--          <el-input v-model="form.orderNum" placeholder="请输入订单数量" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="未排产订单数量" prop="noPcNum">-->
<!--          <el-input v-model="form.noPcNum" placeholder="请输入未排产订单数量" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="排产数量" prop="pcNum">-->
<!--          <el-input v-model="form.pcNum" placeholder="请输入排产数量" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="实际完成数量" prop="finishComNum">-->
<!--          <el-input v-model="form.finishComNum" placeholder="请输入实际完成数量" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="派工数量" prop="pgNum">-->
<!--          <el-input v-model="form.pgNum" placeholder="请输入派工数量" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="完工数量" prop="wgNum">-->
<!--          <el-input v-model="form.wgNum" placeholder="请输入完工数量" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="报工数量" prop="bgNum">-->
<!--          <el-input v-model="form.bgNum" placeholder="请输入报工数量" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="在制品数量" prop="zzNum">-->
<!--          <el-input v-model="form.zzNum" placeholder="请输入在制品数量" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="检验数量" prop="checkNum">-->
<!--          <el-input v-model="form.checkNum" placeholder="请输入检验数量" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="不合格数量" prop="unqualifiedNum">-->
<!--          <el-input v-model="form.unqualifiedNum" placeholder="请输入不合格数量" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="返修数量" prop="returnNum">-->
<!--          <el-input v-model="form.returnNum" placeholder="请输入返修数量" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="料废数量" prop="flNum">-->
<!--          <el-input v-model="form.flNum" placeholder="请输入料废数量" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="机废数量" prop="jfNum">-->
<!--          <el-input v-model="form.jfNum" placeholder="请输入机废数量" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="计划上线时间" prop="planOnlineTime">-->
<!--          <el-date-picker clearable-->
<!--            v-model="form.planOnlineTime"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="请选择计划上线时间">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="实际上线时间" prop="actualOnlineTime">-->
<!--          <el-date-picker clearable-->
<!--            v-model="form.actualOnlineTime"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="请选择实际上线时间">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="计划下线时间" prop="planOfflineTime">-->
<!--          <el-date-picker clearable-->
<!--            v-model="form.planOfflineTime"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="请选择计划下线时间">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="实际下线时间" prop="actualOfflineTime">-->
<!--          <el-date-picker clearable-->
<!--            v-model="form.actualOfflineTime"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="请选择实际下线时间">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="返修上线时间" prop="returnOnlineTime">-->
<!--          <el-date-picker clearable-->
<!--            v-model="form.returnOnlineTime"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="请选择返修上线时间">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="返修下线时间" prop="returnOfflineTime">-->
<!--          <el-date-picker clearable-->
<!--            v-model="form.returnOfflineTime"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="请选择返修下线时间">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="报工时间" prop="bgTimr">-->
<!--          <el-date-picker clearable-->
<!--            v-model="form.bgTimr"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="请选择报工时间">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="检验时间" prop="checkTime">-->
<!--          <el-date-picker clearable-->
<!--            v-model="form.checkTime"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="请选择检验时间">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="质检员工号" prop="checkUserNum">-->
<!--          <el-input v-model="form.checkUserNum" placeholder="请输入质检员工号" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="质检员姓名" prop="checkUserName">-->
<!--          <el-input v-model="form.checkUserName" placeholder="请输入质检员姓名" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="包装时间" prop="packgeTime">-->
<!--          <el-date-picker clearable-->
<!--            v-model="form.packgeTime"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="请选择包装时间">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="核销时间" prop="hxTime">-->
<!--          <el-date-picker clearable-->
<!--            v-model="form.hxTime"-->
<!--            type="date"-->
<!--            value-format="yyyy-MM-dd"-->
<!--            placeholder="请选择核销时间">-->
<!--          </el-date-picker>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="材料" prop="cl">-->
<!--          <el-input v-model="form.cl" placeholder="请输入材料" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="下料" prop="xl">-->
<!--          <el-input v-model="form.xl" placeholder="请输入下料" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="加热" prop="jr">-->
<!--          <el-input v-model="form.jr" placeholder="请输入加热" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="成型" prop="cx">-->
<!--          <el-input v-model="form.cx" placeholder="请输入成型" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="冷却" prop="lq">-->
<!--          <el-input v-model="form.lq" placeholder="请输入冷却" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="粗车" prop="cc">-->
<!--          <el-input v-model="form.cc" placeholder="请输入粗车" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="精车" prop="jc">-->
<!--          <el-input v-model="form.jc" placeholder="请输入精车" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="钻孔" prop="zk">-->
<!--          <el-input v-model="form.zk" placeholder="请输入钻孔" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="检验" prop="jy">-->
<!--          <el-input v-model="form.jy" placeholder="请输入检验" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="包装" prop="bz">-->
<!--          <el-input v-model="form.bz" placeholder="请输入包装" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="备注" prop="remark">-->
<!--          <el-input v-model="form.remark" placeholder="请输入备注" />-->
<!--        </el-form-item>-->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">派 工</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <div style="display: none">
      <div id="printDan" ref="printDan">
        <div style="display: flex;flex-direction: column;padding-top:190px;font-size: 12px;width: 90%;margin:0 auto">
          <div style="width: 100%;height: 20px;text-align: center;line-height: 20px;background: red">
            <span>{{formDan.pcCode}}</span>
            <span style="margin-left: 10px">{{formDan.gwName}}</span>

          </div>
          <div style="width: 100%">
            <div class="qrcode" ref="qrCodeUrl" style="margin-top:5px;margin-left: 8px;float: left;margin-right: 2px;height: 100px;width: 20%;"></div>
            <div style="width: 76%;float: left">
              <div style="width: 100%;height:14px;display: flex;flex-direction: row;border: 1px solid black;text-align: center;line-height: 14px;">

                <div style="width: 25%;border-right: 1px solid black">外径</div>
                <div style="width: 25%;border-right: 1px solid black">内径</div>
                <div style="width: 25%;border-right: 1px solid black">厚度</div>
                <div style="width: 25%">台径*台高</div>
              </div>
              <div style="width: 100%;height:14px;display: flex;flex-direction: row;border: 1px solid black;text-align: center;line-height: 14px">

                <div style="width: 25%;border-right: 1px solid black">{{formDan.wjgc}}</div>
                <div style="width: 25%;border-right: 1px solid black">{{formDan.njgc}}</div>
                <div style="width: 25%;border-right: 1px solid black">{{formDan.hdgc}}</div>
                <div style="width: 25%">{{formDan.tjtg}}</div>
              </div>
              <div style="width: 100%;height:14px;display: flex;flex-direction: row;border: 1px solid black;text-align: center;line-height: 14px">

                <div style="width: 25%;border-right: 1px solid black">孔径+孔数</div>
                <div style="width: 25%;border-right: 1px solid black">派工数量</div>
                <div style="width: 25%;border-right: 1px solid black">计算重量</div>
                <div style="width: 25%">下料重量</div>
              </div>
              <div style="width: 100%;height:14px;display: flex;flex-direction: row;border: 1px solid black;text-align: center;line-height: 14px">

                <div style="width: 25%;border-right: 1px solid black">{{formDan.kjks}}</div>
                <div style="width: 25%;border-right: 1px solid black">{{formDan.pcNum}}</div>
                <div style="width: 25%;border-right: 1px solid black">{{formDan.jszl}}</div>
                <div style="width: 25%">{{formDan.xlzl}}</div>
              </div>
              <div style="width: 100%;height:14px;display: flex;flex-direction: row;border: 1px solid black;text-align: center;line-height: 14px">

                <div style="width: 25%;border-right: 1px solid black">倒角</div>
                <div style="width: 25%;border-right: 1px solid black">水线</div>
                <div style="width: 25%;border-right: 1px solid black">密封面倒角</div>

                <div style="width: 25%">中心距</div>
              </div>
              <div style="width: 100%;height:14px;display: flex;flex-direction: row;border: 1px solid black;text-align: center;line-height: 14px">

                <div style="width: 25%;border-right: 1px solid black">{{formDan.dj}}</div>
                <div style="width: 25%;border-right: 1px solid black">{{formDan.sx}}</div>
                <div style="width: 25%;border-right: 1px solid black">{{formDan.mfmdj}}</div>

                <div style="width: 25%">{{formDan.zxj}}</div>
              </div>
            </div>
          </div>
          <div style="display: flex;flex-direction: row">

            <div style="width: 80%;word-break: break-word;margin-left: 10px;margin-top: 5px;font-size: 10px !important;line-height: 12px !important;">
              <span>{{formDan.content}}</span>
            </div>
          </div>
        </div>
      </div>

<!--    <div style="display: none">-->
<!--      <div id="printDan" ref="printDan">-->
<!--        <div style="display: flex;flex-direction: column;padding-top:20px;font-size: 12px">-->
<!--          <div style="width: 100%;height: 50px;text-align: center;line-height: 50px;background: red">-->
<!--            <span>{{formDan.pcCode}}</span>-->
<!--            <span style="margin-left: 20px">{{formDan.lineName}}</span>-->
<!--            <div style="float:right" class="qrcode" ref="qrCodeUrl"></div>-->
<!--          </div>-->
<!--          <div style="width: 100%;height:30px;display: flex;flex-direction: row;border: 1px solid black;text-align: center;line-height: 30px;margin-top:20px">-->
<!--            <div style="width: 20%;border-right: 1px solid black"></div>-->
<!--            <div style="width: 20%;border-right: 1px solid black">外径</div>-->
<!--            <div style="width: 20%;border-right: 1px solid black">内径</div>-->
<!--            <div style="width: 20%;border-right: 1px solid black">厚度</div>-->
<!--            <div style="width: 20%">台径*台高</div>-->
<!--          </div>-->
<!--          <div style="width: 100%;height:30px;display: flex;flex-direction: row;border: 1px solid black;text-align: center;line-height: 30px">-->
<!--            <div style="width: 20%;border-right: 1px solid black"></div>-->
<!--            <div style="width: 20%;border-right: 1px solid black">{{formDan.wjgc}}</div>-->
<!--            <div style="width: 20%;border-right: 1px solid black">{{formDan.njgc}}</div>-->
<!--            <div style="width: 20%;border-right: 1px solid black">{{formDan.hdgc}}</div>-->
<!--            <div style="width: 20%">{{formDan.tjtg}}</div>-->
<!--          </div>-->
<!--          <div style="width: 100%;height:30px;display: flex;flex-direction: row;border: 1px solid black;text-align: center;line-height: 30px">-->
<!--            <div style="width: 20%;border-right: 1px solid black">中心距</div>-->
<!--            <div style="width: 20%;border-right: 1px solid black">孔径+孔数</div>-->
<!--            <div style="width: 20%;border-right: 1px solid black">派工数量</div>-->
<!--            <div style="width: 20%;border-right: 1px solid black">计算重量</div>-->
<!--            <div style="width: 20%">下料重量</div>-->
<!--          </div>-->
<!--          <div style="width: 100%;height:30px;display: flex;flex-direction: row;border: 1px solid black;text-align: center;line-height: 30px">-->
<!--            <div style="width: 20%;border-right: 1px solid black">{{formDan.zxj}}</div>-->
<!--            <div style="width: 20%;border-right: 1px solid black">{{formDan.kjks}}</div>-->
<!--            <div style="width: 20%;border-right: 1px solid black">{{formDan.pcNum}}</div>-->
<!--            <div style="width: 20%;border-right: 1px solid black">{{formDan.jszl}}</div>-->
<!--            <div style="width: 20%">{{formDan.xlzl}}</div>-->
<!--          </div>-->
<!--          <div style="width: 100%;word-break: break-word">-->
<!--            说明：{{formDan.remark}}-->
<!--          </div>-->
<!--        </div>-->
<!--      </div>-->
    </div>
  </div>
</template>

<script>
  import QRCode from 'qrcodejs2'
import {listControl, getControl, delControl, addControl, updateControl, handRead,getOrderInfoPg,addOrderInfoPg} from "@/api/procontrol/control";
import {listProcessTec} from "@/api/technology/processTec";
import print from 'print-js';

export default {
  name: "ControlOrderInfo",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      lineCode: null,
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 生产过程控制总表格数据
      controlList: [],

      gwCodeList: [],
      //派工用户列表
      userOrderinfoList: [],
      isPgOptions: [{
        value: '0',
        label: '未派工'
      }, {
        value: '1',
        label: '已派工'
      }],
      // 表格的高度
      tableHeight: document.documentElement.scrollHeight - 245 + "px",
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        factoryCode: null,
        factoryName: null,
        orderNo: null,
        choose: null,
        contractNo: null,
        pcCode: null,
        pcDate: null,
        scDate: null,
        jhDate: null,
        lineCode: null,
        lineName: null,
        gwCode: null,
        gwName: null,
        deviceNo: null,
        deviceName: null,
        empNum: null,
        empName: null,
        proType: null,
        gxProCode: null,
        proName: null,
        dyProCode: null,
        dyYclCode: null,
        dyZcNum: null,
        orderNum: null,
        noPcNum: null,
        pcNum: null,
        finishComNum: null,
        pgNum: null,
        wgNum: null,
        bgNum: null,
        zzNum: null,
        checkNum: null,
        unqualifiedNum: null,
        returnNum: null,
        flNum: null,
        jfNum: null,
        planOnlineTime: null,
        actualOnlineTime: null,
        planOfflineTime: null,
        actualOfflineTime: null,
        returnOnlineTime: null,
        returnOfflineTime: null,
        bgTimr: null,
        checkTime: null,
        checkUserNum: null,
        checkUserName: null,
        packgeTime: null,
        hxTime: null,
        cl: null,
        xl: null,
        jr: null,
        cx: null,
        lq: null,
        cc: null,
        jc: null,
        zk: null,
        jy: null,
        bz: null,
        isSh: '1',
        isPg:null,
        itemIdentifyCode:null,
      },
      // 表单参数
      form: {
        listUserOrderInfo:[]
      },
      formDan:{},
      // 表单校验
      rules: {
        gwCode:[
          { required: true, message: "请选择工位编码", trigger: "blur" }
        ]
       /* stationCode: [
          { required: true, message: "请选择派工工位编码", trigger: "blur" }
        ],
        pgGwCode: [
          { required: true, message: "派工工位编码不能为空", trigger: ["blur", "change"] }
        ],
        pgGwName: [
          { required: true, message: "派工工位名称不能为空", trigger: ["blur", "change"] }
        ],
        pgGwFzr2: [
          { required: true, message: "派工工位负责人不能为空", trigger: ["blur", "change"] }
        ],*/
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    printt(row){
      if(row.kjks !=null){
        let kjks = row.kjks
        kjks = kjks.split('*')
        // for(let i=0;i<kjks.length;i++){
        //   kjks[i] = (kjks[i]-0).toFixed(1)
        // }
        kjks[0] = (kjks[0]-0).toFixed(1)
        kjks[1] = (kjks[1]-0).toFixed(0)
        let wjgc = row.wjgc
        wjgc = wjgc.split('±')
        wjgc[0] = (wjgc[0]-0).toFixed(1)
        let njgc = row.njgc
        njgc = njgc.split('±')
        njgc[0] = (njgc[0]-0).toFixed(1)
        let zxj = row.zxj-0
        zxj = zxj.toFixed(1)
        let xlzl = row.xlzl-0
        xlzl = xlzl.toFixed(1)
        let jszl = row.jszl-0
        jszl = jszl.toFixed(1)


        this.formDan = row


        this.formDan.zxj = zxj
        this.formDan.xlzl = xlzl
        this.formDan.jszl = jszl
        this.formDan.kjks = kjks[0]+'*'+kjks[1]
        this.formDan.wjgc = wjgc[0]+'±'+wjgc[1]
        this.formDan.njgc = njgc[0]+'±'+njgc[1]
      }else{
        this.formDan = row
      }

      this.$refs.qrCodeUrl.innerHTML = "";
      var qrcode = new QRCode(this.$refs.qrCodeUrl, {

        text: row.pcCode+'a='+row.gwCode, // 需要转换为二维码的内容
        width: 70,
        height: 90,
        colorDark: '#000000',
        colorLight: '#ffffff',
        correctLevel: QRCode.CorrectLevel.H
      })
      // var qrcode = new QRCode(this.$refs.qrCodeUrl, {
      //   text: row.pcCode, // 需要转换为二维码的内容
      //   width: 50,
      //   height: 50,
      //   colorDark: '#000000',
      //   colorLight: '#ffffff',
      //   correctLevel: QRCode.CorrectLevel.H
      // })
      this.$nextTick(()=>{
        this.priDan()
      })

    },
    priDan(){
      // printBill
      // const style = '@page{margin:0};.title{fontSize:30px}'
      const style = '@page { margin:0 } ' +'@media print { #title{ font-size:40px};#title1{ font-size:40px }  ' ;
      printJS({
        printable:this.$refs.printDan,
        type:'html',
        header:'',
        targetStyles:['*'],
        scanStyles: false,
        style:style,
        onPrintDialogClose: () => {
          console.log('弹窗关闭');
        },
        onLoadingEnd:()=>{
          console.log('加载完毕')
        }
      })
    },
    /** 查询生产过程控制总列表 */
    getList() {
      this.loading = true;
      listControl(this.queryParams).then(response => {
        this.controlList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    tableRowClassName({row, rowIndex}) {
      if (row.pcNum > row.pgNum) {
        return 'warning-row';
      } else{
        return '';
      }
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        factoryCode: null,
        factoryName: null,
        orderNo: null,
        choose: null,
        contractNo: null,
        pcCode: null,
        pcDate: null,
        scDate: null,
        jhDate: null,
        lineCode: null,
        lineName: null,
        gwCode: null,
        gwName: null,
        deviceNo: null,
        deviceName: null,
        empNum: null,
        empName: null,
        proType: null,
        gxProCode: null,
        proName: null,
        dyProCode: null,
        dyYclCode: null,
        dyZcNum: null,
        orderNum: null,
        noPcNum: null,
        pcNum: null,
        finishComNum: null,
        pgNum: null,
        wgNum: null,
        bgNum: null,
        zzNum: null,
        checkNum: null,
        unqualifiedNum: null,
        returnNum: null,
        flNum: null,
        jfNum: null,
        planOnlineTime: null,
        actualOnlineTime: null,
        planOfflineTime: null,
        actualOfflineTime: null,
        returnOnlineTime: null,
        returnOfflineTime: null,
        bgTimr: null,
        checkTime: null,
        checkUserNum: null,
        checkUserName: null,
        packgeTime: null,
        hxTime: null,
        cl: null,
        xl: null,
        jr: null,
        cx: null,
        lq: null,
        cc: null,
        jc: null,
        zk: null,
        jy: null,
        bz: null,
        remark: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.lineCode = selection.map(item => item.lineCode)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    getGwCode(value){
      let selectedName = {};
      selectedName = this.gwCodeList.find((item)=>{
        return item.stationCode === value;
        //筛选出匹配数据，是对应数据的整个对象
      });
      this.form.stationName=selectedName.stationName;
      this.form.pgGwName=selectedName.pgGwName;
      this.form.pgGwCode=selectedName.pgGwCode;
      this.form.pgGwFzr=selectedName.pgGwFzr;
      this.form.pgGwFzr2=selectedName.pgGwFzr2;
      this.form.gwPersonNum=selectedName.gwPersonNum;
      this.form.gwPersonInfo=selectedName.gwPersonInfo;
      this.form.gwPersonInfo2=selectedName.gwPersonInfo2;
      this.$forceUpdate();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加生产过程控制总";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      const lineCode = row.lineCode || this.lineCode[0]
      let param = {
        proLineCode:lineCode
      };
      getControl(id).then(response => {
        listProcessTec(param).then(res=>{
          this.gwCodeList = res.rows;
          this.form = response.data;
          this.open = true;
          this.title = "审核生产过程控制";
        })
      });
    },
    handlePg(row){
      const id = row.id
      getOrderInfoPg(id).then(response => {
        this.form = response.data;
        this.userOrderinfoList = response.data.listUserOrderInfo;
        this.open = true;
        this.title = "工单明细派工";
      });
    },
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '总计';
          return;
        }
        if (index === 1 )  {
          return '';
        }
        const values = data.map(item => Number(item[column.property]));
        if (!values.every(value => isNaN(value))) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
           /*   if(index==4){
                return prev + curr
              }else{
                return this.keepTwoDecimalFull(Number(prev) + curr);
              }*/
              return prev + curr
            } else {
              return prev;
            }
          }, 0);
          sums[index];
        } else {
          sums[index] = '';
        }
      });

      return sums;
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            this.form.isSh='1';
            this.form.listUserOrderInfo=this.userOrderinfoList;
            if(this.userOrderinfoList.length==0){
              this.$modal.alertWarning('未找到需要派工的工人！！！')
              return;
            }
            let zPg=this.form.pgNum;
            for(var i=0;i<this.userOrderinfoList.length;i++){
              if(this.userOrderinfoList[i].pgNum==''||this.userOrderinfoList[i].pgNum==null||this.userOrderinfoList[i].pgNum==undefined ){
                this.$modal.alertWarning('请输派工数量！！！')
                zPg=0;
                return;
              }
              zPg=Number(zPg)+Number(this.userOrderinfoList[i].pgNum);
            }
            if(this.form.pcNum<zPg){
              this.$modal.alertWarning('派工数量已超出排产数量！！！')
              return;
            }
            this.form.isPg=1;
            addOrderInfoPg(this.form).then(response => {
              this.$modal.alertSuccess("派工成功！！！");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(index,row) {
      this.userOrderinfoList.splice(index,1);

    },
   /* /!** 删除按钮操作 *!/
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除生产过程控制总编号为"' + ids + '"的数据项？').then(function() {
        return delControl(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },*/
    /** 导出按钮操作 */
    handleExport() {
      this.download('procontrol/control/export', {
        ...this.queryParams
      }, `control_${new Date().getTime()}.xlsx`)
    },
    handleRead(){
      handRead().then(response => {
        this.$modal.msgSuccess("读取完成！");
        this.getList();
      });
    }
  }
};
</script>
<style lang="scss" scoped>
  ::v-deep .el-table .warning-row {
    background: #ffe4e1;
  }
</style>
